/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.ipti.br.tag.bo;

import org.ipti.br.tag.dao.AddInfoPersonageFacade;
import org.ipti.br.tag.entity.AddInfoPersonage;
import org.ipti.br.tag.entity.AdditionalInfoType;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import javax.ejb.Stateless;

/**
 *
 * @author root
 */
@Stateless
public class AddInfoPersonageBO implements Serializable {

    @Inject
    private AddInfoPersonageFacade addInfoPersonageDAO;

    public AddInfoPersonageFacade getAddInfoPersonageDAO() {
        return addInfoPersonageDAO;
    }

    public void create(AddInfoPersonage addInfoPersonage) {
        getAddInfoPersonageDAO().create(addInfoPersonage);
    }

    public void edit(AddInfoPersonage addInfoPersonage) {
        getAddInfoPersonageDAO().edit(addInfoPersonage);
    }

    public void remove(AddInfoPersonage addInfoPersonage) {
        getAddInfoPersonageDAO().remove(addInfoPersonage);
    }

    public AddInfoPersonage find(Object id) {
        return getAddInfoPersonageDAO().find(id);
    }

    public List<AddInfoPersonage> findAll() {
        return getAddInfoPersonageDAO().findAll();
    }
    
    public void editForSynchronization(AddInfoPersonage addInfoPersonage) {
        getAddInfoPersonageDAO().editForSynchronization(addInfoPersonage);
    }

    public List<AdditionalInfoType> findAddInfoTypesPerPersonage(Long personageID) {
        List<AdditionalInfoType> additionalInfoTypes = new ArrayList<AdditionalInfoType>();
        for (AddInfoPersonage aip : getAddInfoPersonageDAO().findAddInfoPerPersonage(personageID)) {
            additionalInfoTypes.add(aip.getAdditionalInfoType());
        }

        return additionalInfoTypes;
    }

    public List<AdditionalInfoType> findAddInfoTypeWithPersonage() {
        return getAddInfoPersonageDAO().findAddInfoWithPersonage();
    }

    public List<AdditionalInfoType> findAddInfoTypesWithoutPersonage() {
        List<AdditionalInfoType> additionalInfoTypes = new ArrayList<AdditionalInfoType>();
        for (AddInfoPersonage aip : getAddInfoPersonageDAO().findAddInfoWithoutPersonage()) {
            additionalInfoTypes.add(aip.getAdditionalInfoType());
        }

        return additionalInfoTypes;
    }
}